<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<script type="text/javascript">
	$(document).ready(function() {
		$("#orderBtn").click(function(){
			
			var total=0;
			var temp="";
			var answer="";
			for(j=1;j<11;j++)
				{
				temp="";
				answer="";
			for(i=0;i<$("#f1 [name="+j+"]:checked").length;i++ )
				{
				temp=$($("#f1 [name="+j+"]:checked")[i]).val();
				}
			answer=$("#f1 [name="+j+""+j+"]").val();
			
			if(answer==temp){
				
				total=total+1;
			}
			
			
			}
			alert("최종토탈"+total);
			location.href="${initParam.root}/test/leveltestresult.do?total="+total;
		
			
			
		});
	});
	
</script>


<form id="f1">
<c:forEach items="${requestScope.list }" var="list" varStatus="s">
<table width="300">
<tr><td>문제번호</td><td>${s.count }</td></tr>
<tr><td colspan="2">${list.title }</td></tr>
<tr><td colspan="2">${list.content}</td></tr>
<tr><td colspan="2"><input type="radio" name="${s.count }" value="1">${list.ex1}</td></tr>
<tr><td colspan="2"><input type="radio" name="${s.count }" value="2">${list.ex2}</td></tr>
<tr><td colspan="2"><input type="radio" name="${s.count }" value="3">${list.ex3}</td></tr>
<tr><td colspan="2"><input type="radio" name="${s.count }" value="4">${list.ex4}</td></tr>
<input type="hidden" name="${s.count }${s.count }" value="${list.answer}">
</table>

<Br>
</c:forEach> 

<input type="button" id="orderBtn" value="확인">
</form>
